//*******************************************************************
//  ChanceChestCardPanel.java       Author: Jason M. Campbell
//
//  Panel on which to display a Chance or Community Chest Card
//  image.  Will be displayed by clicking a button
//  in ChanceCommChestButtonsPanel.  The images will be drawn on
//  this panel and displayed in a new frame using the 
//  ChanceCommChestButtonsPanel class.
//*******************************************************************

import javax.swing.*;
import java.awt.*;

@SuppressWarnings("serial")
public class ChanceChestPanel extends JPanel
{
	private final int WIDTH = 298, HEIGHT = 175; // panel size
	private ImageIcon image; // image used for the PropertyCard jpg files
	
	// constructor:
	public ChanceChestPanel()
	{		
		setBackground (new Color(200,222,186));
		setPreferredSize (new Dimension(WIDTH, HEIGHT));
	} // end PropertyCardPanel constructor
	
	// will actually draw the image:
	public void paintComponent(Graphics g)
	{	
		super.paintComponent(g);
		image.paintIcon(this, g, 0, 0);	
	} // end paintComponent
	
	// Changes the image based on which button is chosen
	public void changeImageChance(String str)
	{
		// Creates a new ImageIcon from the name (String) of the property selected
		// and repaints
		image = new ImageIcon("./chancecards/" + str);		
		repaint();
	} // end changeImageChest
	
	//Changes the image based on which button is chosen
	public void changeImageChest(String str)
	{
		// Creates a new ImageIcon from the name (String) of the property selected
		// and repaints
		image = new ImageIcon("./communitychestcards/" + str);
		repaint();
	} // end changeImageChest
} // end class ChanceChestCardPanel